package com.ruoyi.warehouse.controller;

import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.warehouse.domain.*;
import com.ruoyi.warehouse.service.CpkcService;
import com.ruoyi.warehouse.service.YlkcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import com.ruoyi.common.core.web.controller.BaseController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/cpkc")
public class CpkcController extends BaseController  {
    @Autowired
    private CpkcService cpkcService;

    /**
     *  查询原料库存列表
     * */
    @RequiresPermissions("warehouse:cpkc:list")
    @GetMapping("/cpkclist")
    public TableDataInfo ylkcList(CpProduct cpProduct)
    {
        startPage();
        List<CpkcFnishedProductInventory> list = cpkcService.selectCpkcList(cpProduct);
        return getDataTable(list);
    }

    /**
     *  查询消耗记录列表
     * */
    @RequiresPermissions("warehouse:cpkc:consume")
    @GetMapping("/consumeList/{cpCode}")
    public TableDataInfo consumeList(@PathVariable String[] cpCode)
    {
        startPage();
        List<FhslQuantityShipped> list = cpkcService.consumeList(cpCode);
        return getDataTable(list);
    }

    /**
     *  查询入库记录列表
     * */
    @RequiresPermissions("warehouse:cpkc:increase")
    @GetMapping("/increaseList/{cpCode}")
    public TableDataInfo increaseList(@PathVariable String[] cpCode)
    {
        startPage();
        List<CprkProductStorageForm> list = cpkcService.increaseList(cpCode);
        return getDataTable(list);
    }

    /**
     *  查询库存详情列表
     * */
    @RequiresPermissions("warehouse:cpkc:inventory")
    @GetMapping("inventoryList/{cpCode}")
    public TableDataInfo inventoryList(@PathVariable String[] cpCode)
    {
        startPage();
        List<CpkcFnishedProductInventory> list = cpkcService.inventoryList(cpCode);
        return getDataTable(list);
    }
}
